<template>
	<view id="view">
		<image id="logo" src="../../static/nefu_logo.png" mode="aspectFit"></image>
		<u-cell title="学工号" :value="account"></u-cell>
		<u-cell title="姓名" :value="name"></u-cell>
		<u-cell title="打卡记录" isLink clickable  @click="goTo('/pages/my_record/my_record')"></u-cell>
		<u-cell v-if="showApprove" title="审批系统" isLink clickable  @click="goTo('/pages/approve/approve')"></u-cell>
		<u-cell v-else title="我的申请" isLink clickable  @click="goTo('/pages/my_apply/my_apply')"></u-cell>
		<u-cell title="退出登录" isLink clickable  @click="logOot"></u-cell>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				account:'',
				name:'',
				showApprove:false
			}
		},
		onLoad() {
			const that = this
			that.account = uni.getStorageSync("account")
			that.name = uni.getStorageSync("name")
			that.showApprove = uni.getStorageSync("position") != "学生"
		},
		methods: {
			logOot(){
				const that = this
				uni.showModal({
					title: '退出登录',
					content: '确定要退出此账号码',
					success: function (res) {
						if (res.confirm) {
							that.myData.token=""
							uni.removeStorageSync("account")
							uni.removeStorageSync("password")
							uni.removeStorageSync("name")
							uni.removeStorageSync("position")
							uni.redirectTo({
								url:"/pages/login/login"
							}) 
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	#view{
		#logo{
			width: 300upx;
			height: 300upx;
			display: block;
			margin: 0 auto;
			margin-top: 50upx;
		}
	}
</style>

